<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>Demo</title>

</head>

<body>

<p id="w1"></p>

<div id="main" style="width: 600px;height:400px;"></div>
</body>
<script src="jquery-1.12.4.js"></script>
<script src="echarts.js"></script>
<script>

    var webSocket = new WebSocket(
        //"ws://10.5.20.42:2424/websocket"
        "ws://192.168.1.22:2424/websocket"
    );

    webSocket.onerror = function (event) {
        console.log(event);
        console.log('onerror')
    };

    webSocket.onopen = function (event) {
        console.log(event);
        console.log('onopen')
    };

    webSocket.onmessage = function (event) {
        document.getElementById("w1").innerText = event.data;
        console.log('onmessage');
    }

</script>

</html>